<div class="content">
    <!--- Bread Crumbs Menu -->
    <div class="breadLine">
        <ul class="breadcrumb">
            <li><a href="/">Admin</a> <span class="divider">></span></li>
            <li class="active"><a href="/">User</a> <span class="divider">></span></li>     
            <li class="active"><?php echo Config::get_page(); ?></li>
        </ul>
        <?php
            //echo $this->setLayout("breadcrumbs_right_menu");
            // User Information
            $fs = new Functions();
            $library_uInfo = Library::get_info();
            $required = "";
            if($library_uInfo['auth']['level_id'] != "1"){
                $required = "validate[required]";
            }
        ?>
    </div>

   <div class="workplace">

        <div class="row-fluid">
            <div class="span12">
                <div class="head clearfix">
                    <div class="isw-calendar"></div>
                        <h1><?php echo Config::get_page(); ?></h1>
                    </div>
                    <div class="row-fluid">
                        <div class="span6">
                            <div class="widget">
                                <div class="head dark">
                                    <div class="icon title_icon"><i class="fa fa-user"></i></div>
                                    <h2>User Profile</h2>
                                </div>                        
                                <div class="block-fluid">
                                    <form id="edit_profile_user" action="/ajax/users?action=update_user&amp;type=update" enctype="multipart/form-data" method="POST">
                                        <div class="row-form">
                                            <div class="span3">
                                                <div class="image">
                                                <?php
                                                    $array = array("id" =>  $library_uInfo['auth']['id'],
                                                    "title" =>  $library_uInfo['info']->first_name . " " . $library_uInfo['info']->last_name,
                                                    "width" =>  "50",
                                                    "height" =>  "50",
                                                    "class" =>  "img-polaroid",
                                                    "style" =>  "",
                                                    "size"  =>  "small");
                                                    echo $fs->avatarPic($array);
                                                ?>
                                                    </div>
                                            </div>
                                            <div class="span7">
                                                <div class="input-append file" style="margin-top: 20px;">
                                                    <input type="file" name="file" id="user_<?php echo md5(md5($library_uInfo['auth']['id'])); ?>" class="upload" data-loc="img-file-<?php echo md5(md5($library_uInfo['auth']['id'])); ?>">
                                                    <input type="text">
                                                    <a class="btn">Browse</a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">First Name:*</div>
                                            <div class="span9"><input type="text" name="first_name" class="validate[required]" placeholder="Enter your first name" value="<?php echo $library_uInfo['info']->first_name; ?>"></div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">Last Name:*</div>
                                            <div class="span9"><input type="text" name="last_name" class="validate[required]" placeholder="Enter your last name" value="<?php echo $library_uInfo['info']->last_name; ?>"></div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">Email:*</div>
                                            <div class="span9"><input type="text" name="email" class="validate[required,custom[email]]" placeholder="enter your email" value="<?php echo $library_uInfo['info']->email; ?>"></div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">Login / Username:*</div>
                                            <div class="span9"><input type="text" name="username" class="validate[required,maxSize[8]]" placeholder="enter your preferred login" value="<?php echo $library_uInfo['auth']['username']; ?>"></div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">Access Role:*</div>
                                            <div class="span9">
                                                <select name="access_role" id="select_role" class="select_role <?php echo $required; ?>">
                                                    <?php
                                                        $db = new Database();
                                                        $role_fs = new Role_Functions();
                                                        echo $role_fs->load_roles($db,$library_uInfo['auth']['level_id']);
                                                    ?>                                                                        
                                                </select>
                                            </div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">Department Unit:*</div>
                                            <div class="span9">
                                                <select name="department_unit" id="chosen_department" class="select_department <?php echo $required; ?>">
                                                    <?php
                                                        echo $role_fs->load_department($db,$library_uInfo['info']->department);
                                                    ?>    
                                                </select>
                                            </div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">Brand Category:*</div>
                                            <div class="span9">
                                                <select name="brand_category" id="chosen_brand_category" class="<?php echo $required; ?>">
                                                    <?php
                                                        echo $role_fs->load_brand_category($db,$library_uInfo['info']->brand_category);
                                                    ?>   
                                                </select>
                                            </div>
                                        </div>
                                        <div class="row-form" style="height: 52px;">
                                            <input type="hidden" name="user_id" value="<?php echo $library_uInfo['auth']['id']; ?>">
                                            <input type="hidden" name="set_active" value="<?php echo $library_uInfo['auth']['is_active']; ?>">
                                            
                                        </div>

                                        
                                        <div class="toolbar bottom TAR">
                                            <button class="btn btn-info" type="button" onclick="$('#validate').validationEngine('hide');">Hide prompts</button>
                                            <button class="btn btn-primary">Update</button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                            <div class="widget">
                                <div class="head dark">
                                    <div class="icon title_icon"><i class="fa fa-edit"></i></div>
                                    <h2>Change Password</h2>
                                </div>                        
                                <div class="block-fluid">
                                    <form id="validate_password" method="POST" action="javascript:notify('Validation','Form #validate_password submited');">
                                        <div class="row-form">
                                            <div class="span3">Current Password:</div>
                                            <div class="span9"><input type="password" name="current_password" class="validate[required,minSize[5]]" placeholder="Your Current Password"></div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">New Password:</div>
                                            <div class="span9"><input type="password" name="new_password" id="new_password" class="validate[required,minSize[5]]" placeholder="Enter your new password"></div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">Re-Type password:</div>
                                            <div class="span9"><input type="password" name="retype_password" class="validate[required,equals[new_password]]" placeholder="Re - type your password"></div>
                                        </div>
                                        <div class="row-form">
                                        </div>
                                        <div class="row-form">
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">Registration Date:</div>
                                            <div class="span9">
                                            <?php
                                            $reg_date = $fs->set_date_format($library_uInfo['info']->date_created);
                                            echo $reg_date['date_time'];
                                            ?>
                                            </div>
                                        </div>
                                        <div class="row-form">
                                            <div class="span3">Last Visit Date</div>
                                            <div class="span9">
                                            <?php
                                            $last_visit= $fs->set_date_format($library_uInfo['info']->last_visit->date);
                                            echo $last_visit['date_time'];
                                            ?>
                                            </div>
                                        </div>
                                        <div class="toolbar bottom TAR">
                                            <button class="btn btn-info" type="button" onclick="$('#validate_password').validationEngine('hide');">Hide prompts</button>
                                            <button class="btn btn-primary">Update</button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                </div>
            </div>    
        </div>

   </div>

</div> 